package com.dongwu.manager.service.impl;

import com.dongwu.common.service.impl.BaseServiceImpl;
import com.dongwu.manager.dao.TemplateDao;
import com.dongwu.manager.entity.TemplateType;
import com.dongwu.manager.service.TemplateTypeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.util.List;

@Service
public class TemplateTypeServiceImpl extends BaseServiceImpl<TemplateType, String> implements TemplateTypeService {


    @Resource
    private TemplateDao templateDao;

    @PersistenceContext
    protected EntityManager entityManager;


    @Override
    public List<TemplateType> findList(List<String> ids) {
        return templateDao.findByTemplateTypeId(ids);
    }

    @Override
    public TemplateType findByTemplateTypeSn(String templateTypeSn) {
        return templateDao.findByTemplateTypeSn(templateTypeSn);
    }

    @Override
    public TemplateType update(TemplateType entity) {
        entityManager.clear();
        return super.update(entity);
    }
}
